package com.lyk.coursearrange.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lyk.coursearrange.dao.JurisdictionDao;
import com.lyk.coursearrange.entity.Jurisdiction;
import com.lyk.coursearrange.entity.dto.JurisdictionDto;
import com.lyk.coursearrange.service.JurisdictionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JurisdictionServiceImpl extends ServiceImpl<JurisdictionDao, Jurisdiction> implements JurisdictionService {

    @Autowired
    private JurisdictionDao jurisdictionMapper;

    @Override
    public List<JurisdictionDto> jurisdictionlist(Long po_id,String jur_title) {
        if(po_id!=0) {
            //返回全字段
            return jurisdictionMapper.findByPoId(po_id);
            //单返回id
            //return jurisdictionMapper.findByPoIdTwo(po_id);
        }else if(po_id==0&&jur_title==null) {
            return jurisdictionMapper.selectJurisdictionparentid(0L);
        }else {
            return jurisdictionMapper.selectJurAllByName(jur_title);
        }
    }

    @Override
    public List<Long> jurisdictionlisttwo(Long po_id) {
        return jurisdictionMapper.findByPoIdTwo(po_id);
    }
}
